import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "../views/Layout.vue";

import member_workbench from "./member_workbench";
import market_industryoverview from "./market_industryoverview";
import search_video from "./search_video";
import search_article from "./search_article";
import search_album from "./search_album";
import rank_hot_video from "./rank_hot_video";
import tag_video_tag from "./tag_video";
import search_video_activity from "./search_video_activity";
import search_blogger from "./search_blogger";
import rank_author from "./rank_author";
import search_price from "./search_price";
import monitor_blogger from "./monitor_blogger";
import monitor_video from "./monitor_video";
import monitor_live from "./monitor_live";
import search_brand from "./search_brand";
import rank_brand from "./rank_brand";
import brand_launch from "./brand_launch";
import brand_diagnosis from "./brand_diagnosis";
import search_goods from "./search_goods";
import search_goods_video from "./search_goods_video";
import rank_goods from "./rank_goods";
import search_live from "./search_live";
import rank_live from "./rank_live";
import rank_gift from "./rank_gift";
import search_game from "./search_game";
import rank_game from "./rank_game";
import favorite_blogger from "./favorite_blogger";
import favorite_video from "./favorite_video";
import favorite_brand from "./favorite_brand";
import favorite_goods from "./favorite_goods";

Vue.use(VueRouter);

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push;
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
const routes = [
  {
    path: "/",
    name: "Layout",
    component: Layout,
    children: [
      ...member_workbench,
      ...market_industryoverview,
      ...search_video,
      ...search_article,
      ...search_album,
      ...rank_hot_video,
      ...tag_video_tag,
      ...search_video_activity,
      ...search_blogger,
      ...rank_author,
      ...search_price,
      ...monitor_blogger,
      ...monitor_video,
      ...monitor_live,
      ...search_brand,
      ...rank_brand,
      ...brand_launch,
      ...brand_diagnosis,
      ...search_goods,
      ...search_goods_video,
      ...rank_goods,
      ...search_live,
      ...rank_live,
      ...rank_gift,
      ...search_game,
      ...rank_game,
      ...favorite_blogger,
      ...favorite_brand,
      ...favorite_goods,
      ...favorite_video,
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
